﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio
{
    /// <summary>
    /// 定义返回数据结果集的[分页模型对象]
    /// </summary>
    /// <typeparam name="T">对象模型</typeparam>
    public class ResultListPage<T> : ResultList<T>
    {
        /// <summary>
        /// 每个分页的记录数
        /// </summary>
        public int PageSize { get; set; }
        /// <summary>
        /// 当前页码/当前的分页页号(默认:1)
        /// </summary>
        public int PageIndex { set; get; }
        /// <summary>
        /// 当前可以被分页的记录的总数(数据总行数)
        /// </summary>
        public int RecordCount { set; get; }
        /// <summary>
        /// 当前分页总数
        /// </summary>
        public int PageCount { get { return PageSize > 0 ? Convert.ToInt32(Math.Ceiling((decimal)(RecordCount / PageSize))) : 1; } }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public ResultListPage() : base() { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        public ResultListPage(List<T> argResultData) : base(argResultData) { }

        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argResultMsg">信息描述</param>
        public ResultListPage(string argResultMsg) : base(argResultMsg) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argResultMsg">信息描述</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(string argResultMsg, List<T> argResultData) : base(argResultMsg, argResultData) { }

        /// <summary>
        /// 带参构造函数
        /// </summary>
        public ResultListPage(ResultStatus argResultCode) : base(argResultCode) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        public ResultListPage(ResultStatus argResultCode, List<T> argResultData) : base(argResultCode, argResultData) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argResultCode">状态代码</param>
        /// <param name="argResultMsg">信息描述</param>
        public ResultListPage(ResultStatus argResultCode, string argResultMsg) : base(argResultCode, argResultMsg) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argResultCode">状态代码</param>
        /// <param name="argResultMsg">信息描述</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(ResultStatus argResultCode, string argResultMsg, List<T> argResultData) : base(argResultCode, argResultMsg, argResultData) { }

        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount) : base() { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, List<T> argResultData) : base(argResultData) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultMsg">信息描述</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, string argResultMsg) : base(argResultMsg) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultMsg">信息描述</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, string argResultMsg, List<T> argResultData) : base(argResultMsg, argResultData) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultCode">状态代码</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, ResultStatus argResultCode) : base(argResultCode) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultCode">状态代码</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, ResultStatus argResultCode, List<T> argResultData) : base(argResultCode, argResultData) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultCode">状态代码</param>
        /// <param name="argResultMsg">信息描述</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, ResultStatus argResultCode, string argResultMsg) : base(argResultCode, argResultMsg) { }
        /// <summary>
        /// 带参构造函数
        /// </summary>
        /// <param name="argPageSize">分页的记录数</param>
        /// <param name="argPageIndex">当前页码/当前的分页页号</param>
        /// <param name="argRecordCount">当前可以被分页的记录的总数</param>
        /// <param name="argResultCode">状态代码</param>
        /// <param name="argResultMsg">信息描述</param>
        /// <param name="argResultData">数据模型对象集合</param>
        public ResultListPage(int argPageSize, int argPageIndex, int argRecordCount, ResultStatus argResultCode, string argResultMsg, List<T> argResultData) : base(argResultCode, argResultMsg, argResultData) { }
    }
}
